package com.nmf.site.common;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import redis.clients.jedis.Jedis;

@Component
public class JedisService {
	@Value("${redis.host}")
	private String host;
	@Value("${redis.port}")
	private int port;
	@Value("${redis.password}")
	private String password;
	private int timeout = 2000;
	
	public Jedis getClient() {
		Jedis jedis = new Jedis(host,port,timeout);
		jedis.auth(password);
		return jedis;
	}

	public void returnBrokenResource(Jedis jedis) {
		// TODO Auto-generated method stub
		jedis.close();
	}
	
	
}
